package com.supermarket.api.web.admin;

import com.supermarket.api.bean.order.pay.AliPayReq;
import com.supermarket.api.common.BaseResponse;
import com.supermarket.api.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.validation.Valid;

/**
 * 支付宝接口
 * @author 李其伟
 * @date 2023/12/15
 */
@Controller
@RequestMapping("/admin/aliPay")
public class AdminAliPayController {

    /**
     * 支付服务层
     */
    @Autowired
    private PayService payService;

    @ResponseBody
    @PostMapping("/pay")
    public String confirmOrder(@Valid @RequestBody AliPayReq aliPayReq){
        String body = payService.aliPay(aliPayReq);
        return BaseResponse.successJson(body);
    }

}
